<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:drawingui="clr-namespace:OpenLS.Drawing.UI"
    xmlns:drawing="http://schemas.Kherty.com/office/2007/drawing"
    xmlns:Internals="clr-namespace:OpenLS.Drawing.UI.Internals"
    x:Class="OpenLS.Drawing.UI.DrawingResources"
    >
  <ResourceDictionary.MergedDictionaries>
        <drawingui:TextResources/>
        <drawingui:ShapeResources/>
        <drawingui:ConnectorResources/>
    </ResourceDictionary.MergedDictionaries>
  
  
  <DataTemplate DataType="{x:Type drawing:FontScheme}" x:Key="smallFontScheme">
    <StackPanel Orientation="Horizontal"  MaxHeight="38" TextElement.FontSize="22">
      <TextBlock FontFamily ="{Binding MajorFont.Latin}">A</TextBlock>
      <TextBlock FontFamily ="{Binding MinorFont.Latin}">a</TextBlock>
    </StackPanel>
  </DataTemplate>
  <HierarchicalDataTemplate DataType="{x:Type drawing:FontScheme}">
    <StackPanel Orientation="Horizontal" ToolTip="{Binding Name}">
      <Border BorderBrush="Black" BorderThickness="1" Background="LightGray" VerticalAlignment ="Bottom" >
        <ContentControl Content ="{Binding}" ContentTemplate="{StaticResource smallFontScheme}"/>
      </Border>

      <StackPanel Margin="5 0 0 0">
        <TextBlock FontSize="16" FontFamily="{Binding MajorFont.Latin}" Text="{Binding MajorFont.Latin.Source}"/>
        <TextBlock FontSize="12" FontFamily="{Binding MinorFont.Latin}" Text="{Binding MinorFont.Latin.Source}"/>
      </StackPanel>
    </StackPanel>
  </HierarchicalDataTemplate>

  <Style TargetType="{x:Type Rectangle}" x:Key="rect1">
    <Setter Property="Height" Value="5"/>
    <Setter Property="Width" Value="6"/>
    <Setter Property="Margin" Value="1 1 0 0 "/>
  </Style>
  <DataTemplate DataType="{x:Type drawing:ColorScheme}" x:Key="miniColorScheme">
    <StackPanel Orientation="Horizontal">
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent1"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent2"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent3"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent4"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent5"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect1}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent6"></Binding>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
    </StackPanel>
  </DataTemplate>
  <Style TargetType="{x:Type Rectangle}" x:Key="rect7">
    <Setter Property="Height" Value="7"/>
    <Setter Property="Width" Value="7"/>
  </Style>
  <DataTemplate DataType="{x:Type drawing:ColorScheme}" x:Key="smallColorScheme">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
      </Grid.ColumnDefinitions>
      <Rectangle Style="{StaticResource rect7}" Grid.Row="0" Grid.Column="0">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Light2"></Binding>
            <Binding></Binding>
                        <Binding Source="fromsmallcolorscheme"/>
                    </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect7}" Grid.Row="0" Grid.Column="1">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Dark2"></Binding>
            <Binding></Binding>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect7}" Grid.Row="1" Grid.Column="0">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent1"></Binding>
            <Binding></Binding>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect7}" Grid.Row="1" Grid.Column="1">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent2"></Binding>
            <Binding></Binding>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
    </Grid>
  </DataTemplate>
  <HierarchicalDataTemplate DataType="{x:Type drawing:ColorScheme}">
    <StackPanel Orientation="Horizontal" ToolTip="{Binding Name}">
      <StackPanel.Resources>
        <Style TargetType="{x:Type Rectangle}" x:Key="rect14">
          <Setter Property="Height" Value="14"/>
          <Setter Property="Width" Value="14"/>
          <Setter Property="Margin" Value="1 1 0 0 "/>
        </Style>
      </StackPanel.Resources>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Dark2"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Light2"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent1"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent2"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent3"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent4"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent5"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Style="{StaticResource rect14}">
        <Rectangle.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
            <Binding Path="Accent6"/>
            <Binding/>
          </MultiBinding>
        </Rectangle.Fill>
      </Rectangle>
      <TextBlock Text="{Binding Name}"/>
    </StackPanel>
  </HierarchicalDataTemplate>

  <DataTemplate DataType="{x:Type drawing:Theme}" x:Key="smallThemeTemplate">
      <Border BorderBrush="Black" BorderThickness="1" Height="48" Width="48">
        <Border BorderBrush="Black" BorderThickness="1" Margin="1">
          <StackPanel Orientation="Vertical" Background="White" Margin="2 0 0 0 ">
            <ContentControl Content="{Binding FontScheme}" ContentTemplate="{StaticResource smallFontScheme}">
              <TextElement.Foreground>
                <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
                  <Binding Path="ColorScheme.Dark2"></Binding>
                  <Binding Path="ColorScheme"/>
                </MultiBinding>
                              
              </TextElement.Foreground>
            </ContentControl>
            <Rectangle Width="42" Height="2" Fill ="LightGray" Margin="2 1 0 1"/>
            <Rectangle Width="42" Height="2" Fill ="LightGray" Margin="2 1 0 1"/>
            <ContentControl Content="{Binding ColorScheme}" ContentTemplate="{StaticResource miniColorScheme}"  Margin="0"></ContentControl>
          </StackPanel>
        </Border>
      </Border>
  </DataTemplate>
  <DataTemplate DataType="{x:Type drawing:Theme}"> <!--TODO factorize-->
    <Grid Width="70"  SnapsToDevicePixels="True" ToolTip="{Binding Name}">
      <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
      </Grid.RowDefinitions>
      <Border BorderBrush="Black" BorderThickness="1" Height="48" Width="64">
        <Border BorderBrush="Black" BorderThickness="1" TextElement.FontSize="22" Height="44" Width="50" Margin="1" HorizontalAlignment="Left">
          <StackPanel Orientation="Vertical" Background="White" Margin="2 0 0 0 ">
            <ContentControl Content="{Binding FontScheme}" ContentTemplate="{StaticResource smallFontScheme}">
              <TextElement.Foreground>
                <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
                  <Binding Path="ColorScheme.Dark2"></Binding>
                  <Binding Path="ColorScheme"></Binding>
                </MultiBinding>
              </TextElement.Foreground>
            </ContentControl>
            <Rectangle Width="42" Height="2" Fill ="LightGray" Margin="2 1 0 1"/>
            <Rectangle Width="42" Height="2" Fill ="LightGray" Margin="2 1 0 1"/>
            <ContentControl Content="{Binding ColorScheme}" ContentTemplate="{StaticResource miniColorScheme}" Margin="0"/>
          </StackPanel>
        </Border>
      </Border>
      <TextBlock Text="{Binding Name}" TextAlignment="Center" Grid.Row="1"/>
    </Grid>
  </DataTemplate>

</ResourceDictionary>